package org.madgecko.api.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.madgecko.api.model.enumeration.MessageCategory;
import org.madgecko.common.enumeration.Status;

import javax.persistence.*;
import java.util.Date;

/**
 * Author       : MadFrog
 * Date         : 2018/11/8 20:37
 * Description  : 信息
 */
@Entity
@Table(name = "t_message")
@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
public class Message {
    /**
     * 主键
     */
    private Integer id;
    /**
     * 标题
     */
    private String title;
    /**
     * 分类
     */
    private MessageCategory category;
    /**
     * 关键词
     */
    @Transient
    private String keywords;
    /**
     * 摘要
     */
    private String summary;
    /**
     * 内容
     */
    private String content;
    /**
     * 消息在列表里预览图 相对路径
     */
    private String preview;
    /**
     * 状态
     */
    private Status status;
    /**
     * 创建时间
     */
    private Date createDate;

    public Message() {
    }

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public MessageCategory getCategory() {
        return category;
    }

    public void setCategory(MessageCategory category) {
        this.category = category;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getPreview() {
        return preview;
    }

    public void setPreview(String preview) {
        this.preview = preview;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    @Column(name = "create_date")
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Override
    public String toString() {
        return "Message{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", category=" + category +
                ", keywords='" + keywords + '\'' +
                ", summary='" + summary + '\'' +
                ", content='" + content + '\'' +
                ", preview='" + preview + '\'' +
                ", status=" + status +
                ", createDate=" + createDate +
                '}';
    }
}